package educrypt.gui.components;

import java.awt.event.ActionListener;

import educrypt.gui.view.AnalysisView;
import educrypt.gui.view.TextOptionsView;
import educrypt.gui.view.TextView;

class AnalysisPanel extends EducryptPanel implements AnalysisView {

	private static final long serialVersionUID = 3173078410392954249L;

	private TextPanel textSubPanel;
	private TextOptionsPanel textOptionsPanel;
	private AnalysisOptionsPanel optionsSubPanel;
	private AnalysisResultPanel resultSubPanel;

	public AnalysisPanel() {
		this.setSize(740, 650);
		this.setPreferredSize(this.getSize());
		setLayout(null);

		textSubPanel = new TextPanel();
		textSubPanel.setBounds(0, 0, 740, 80);
		textSubPanel.setCryptanalysisContext();
		this.add(textSubPanel);

		optionsSubPanel = new AnalysisOptionsPanel();
		optionsSubPanel.setBounds(0, 160, 740, 80);
		this.add(optionsSubPanel);

		resultSubPanel = new AnalysisResultPanel();
		resultSubPanel.setBounds(0, 240, 740, 410);
		this.add(resultSubPanel);

		textOptionsPanel = new TextOptionsPanel();
		textOptionsPanel.setBounds(0, 80, 740, 80);
		add(textOptionsPanel);
	}

	@Override
	public void addListener(ActionListener ctr) {
		this.textSubPanel.addListener(ctr);
		this.textOptionsPanel.addListener(ctr);
		this.optionsSubPanel.addListener(ctr);
		this.resultSubPanel.addListener(ctr);
	}

	/* Getters */
	@Override
	public TextView getTextPanel() {
		return textSubPanel;
	}

	@Override
	public TextOptionsView getTextOptionsPanel() {
		return textOptionsPanel;
	}

	@Override
	public AnalysisOptionsPanel getOptionsPanel() {
		return optionsSubPanel;
	}

	@Override
	public AnalysisResultPanel getResultPanel() {
		return resultSubPanel;
	}
}
